Learn R Programming

DoE.base (version 0.2)

Plotting class design objects: Plotting class design objects

Description

The plot method for class design objects; other methods are part of a separate help page.

Usage

## S3 method for class 'design':
plot(x, y=NULL, select=NULL, selprop=0.25, ask=NULL, ...)

Arguments

x
data frame of S3 class design
y
a character vector of names of numeric variables in x to be plotted as responses, or a numeric response vector, or a numeric matrix containing response columns, or a data frame of numeric response variables (the latter would not
select
Specification of selected factors through option select has been introduced in order to obtain manageable plot sizes. For example, mosaic plots are most easily readible for up to three or at most four factors. Main effect
selprop
a number between 0 and 1 indicating which proportion of worst cases to plot in case select=worst or select=worst.rel is to be plotted (see Details section). The default is useful for small designs only. Fo
ask
a logical that is relevant only if select requests plots of all pairs, triples or quadruples from a set of factors; for the default setting NULL, ask is TRUE if the current graphics
...
further arguments to functions plot, mosaic, or the function plot.design from package grap

Value

  • The plot method is called for its side effects and returns NULL.

Details

Items of class design are data frames with attributes, that have been created for conducting experiments. Apart from the plot method documented here, separate files document the methods formula.design, lm.design, and further methods. The method for plot calls the method available in package graphics (see plot.design) wherever this makes sense (x not of class design, x of class design but not following the class design structure defined in package DoE.base, and x a design with all factors being R-factors and at least one response available). Function plot.design from package graphics is not an adequate choice for designs without responses or designs with experimental factors that are not R-factors. For designs with all factors being R-factors and no response defined (e.g. a freshly-created design from function link{oa.design}), function plot.design creates a mosaic plot of the frequency table of the design, which may be quite useful to understand the structure for designs with relatively few factors (cf. example below; function plot.design calls function mosaic for this purpose). For designs with at least one experimental factor that is not an R-factor, function plot.design calls function plot.data.frame in order to create a scatter plot matrix. Currently, there is no good method for plotting designs with mixed qualitative and quantitative factors. If option select is set to "all2", "all3" or "all4", or a list with a numeric vector as its first element and one of these as the second element, or with select as any of "complete", "worst" or "worst.rel", response variables are ignored, and mosaic plots are created. These requests usually ask for several plots; note that the plots are created one after the other; with an interactive graphics device, the default is that they overwrite each other after a user confirmation for the next plot, which allows users to visually inspect them one at a time; under Windows, the plotting series can be aborted using the Esc-key. With non-interactive graphics devices, the default is ask=FALSE (e.g. for storing all the plots in a multi-page file, see examples). If option select is any of "all2", "all3" or "all4", mosaic plots of all pairs, triples or quadruples of factors are created as specified. Note that "all2" is interesting for non-orthogonal designs only, e.g. ones created by function Dopt.design. If option select is set to "complete", "worst" or "worst.rel", the worst case tuples to be displayed are selected by function tupleSel.

See Also

See also the following functions known to produce objects of class design: FrF2, pb, fac.design, oa.design, and function plot.design from package graphics; a method for function lm is described in the separate help file lm.design.

Examples

Run this code
#### Examples for plotting designs
oa12 <- oa.design(nlevels=c(2,2,6))
  ## plotting a design without response (uses function mosaic from package vcd)
  plot(oa12)
  ## equivalent to mosaic(~A+B+C, oa12)
  ## alternative order: mosaic(~C+A+B, oa12)
  plot(oa12, select=c(3,1,2))
  ## using the select function: the plots show that the projection for factors
  ## C, D and E (columns 3, 14 and 15 of the array) is a full factorial,
  ## while A, D and E (columns 1, 14, and 15 of the array) do not occur in
  ## all combinations
  plan <- oa.design(L24.2.13.3.1.4.1,nlevels=c(2,2,2,3,4))
  plot(plan, select=c("E","D","A"))
  plot(plan, select=c("E","D","C"))
  plot(plan, select="all3")
  plot(plan, select=list(c(1,3,4,5), "all3"))
  ## use the specialist version of option sub
  plot(plan, select=list(c(1,3,4,5), "all3"), sub="A")
  ## create a file with mosaic plots of all 3-factor projections
  pdf(file="exampleplots.pdf")
  plot(plan, select="all3", main="Design from L24.2.13.3.1.4.1 in default column order)")
  plot(plan, select="worst", selprop=0.3, sub="A")
  dev.off()
  ## the file exampleplots.pdf is now available within the current working
  ## directory

  ## plotting a design with response
  y=rnorm(12)
  plot(oa12, y)
  ## plot design with a response included
  oa12.r <- add.response(oa12,y)
  plot(oa12.r)
  ## plotting a numeric design (with or without response,
  ##   does not make statistical sense here, for demo only)
  noa12 <- qua.design(oa12, quantitative="all")
  plot(noa12, y, main="Scatter Plot Matrix")

Run the code above in your browser using DataLab